Recently, I have learned how powerful VBA is to modify an Excel report. This report was written by Daniel three years ago. Just open this file every day, the Dev and UAT databases in Oracle are automatically connected to read the latest market data and six perspectives are generated, compare the data similarities and differences between Dev and UAT. The convenience of using VBA to operate data and the compl
IsNull function to check whether the variable is a Null value.(5) vbEmptyChecks whether a variant variable is initialized.(6) Nothing keywordsIt can only be used with object variables to determine whether a variable has a valid object reference. In addition, the Nothing keyword can be used to destroy the current object reference.(For more information about constants, see Data Types in the ExcelVBA programming series (1): constants.)------------------
Order Information:Excel VBA application development can be ordered from the second bookstore from the basics to practicesHttp://www.cnblogs.com/maweifeng/archive/2006/08/22/483790.html
Since last year, some people have repeatedly posted questions or sent emails for the electronic version of "Excel and VBA programming" released on my website. If I haven't reflect
VBA Excel programming three-day discussion (1)
VBA Excel programming three-day discussion (2)
VBA Excel programming three-day discussion (3)
Basic table operations
Due to the wide range of table operations, this article mainly us
About Excel VBAProgramInterface Programming
○ The Excel VBA program interface is related to its form. For macro loading, a new button or menu must be added. You can click these interface elements to complete the work;
○ For common worksheet programs, you can add required buttons, or directly add buttons, list boxes, and other interface elements to the worksheet. The event processing program is located
Programming below is VB to open the file code:
If Dir ("D:\excel.bz") = "Then" Determines whether Excel is open
Set xlapp = CreateObject ("Excel.Application") ' Create Excel application class
xlapp.visible = True ' Set Excel visible
Set xlbook = XlApp.Workbooks.Open ("D:\test.xls") Open Excel workbook
Set xlsheet = xlbook.worksheets (1) ' Opens Excel worksheet
Activeworkbook.save
Xlapp.displayalerts = False
xlapp.screenupdating = True
xlApp.Q
Chinese test, often used in writing manuscript paper, Word with the template, but there are many restrictions (such as paper type, number of rows and so on relatively fixed), in the examination papers typesetting is quite inconvenient. After trying, the author found a way to use Word VBA programming to realize the test writing manuscript by drawing the form.
I. Preparation of procedures
1. Start Word, cli
The following content is related to the sections or Section object of VBA programming in Word documents, and you want to help.
ActiveDocument.Sections.First ' The first section of the current document
ActiveDocument.Sections.First.PageSetup.BottomMargin ' The bottom margin of the page where the first section of the current document is located
ActiveDocument.Sections.First.PageSetup.LeftMargin ' The left
Purpose : Sometimes we need to organize a large amount of data in an Excel file, which can be tedious and error-prone if you use manual grooming. In the case of VBA, it is possible to automate a large amount of data collation by writing a simple code in Excel based on requirements.1, in Excel 2007, for example, if you want to do VBA programming, you need to enabl
The analysis of subway subsidence observation data using VBA programming processWhen you're tired of watching the day, you're back looking at hundreds of measurements and reporting. If it's a 35-page report, it's okay to say that if it's a 2000-point report, it will have about 70 pages of reports on a page of paper 30. As the force of the surveyors, but also more bitter force is no settlement data analysis
left blank.Sub InsertRow ()Dim LastRow as long, I as Long, J as LongApplication.cutcopymode = FalseLastRow = Cells (Cells.Rows.Count, 3). End (3). Rowi = 1Do If IsNumeric (Cells (I, 3)) and Len (cells (I, 3)) > 0 Then If cells (I, 3) Rows (I ":" i + 1). Insert Shift:=xldown j = j + 1 Cells (i, 1) = "ZD" J i = i + 2 LastRow = Cells (Cells.Rows.Count, 3). End (3). Row End If End If i = i + 1Loop Until i > LastRowEnd
Excel VBA programming to draw a house on a form . This tutorial is to introduce you to use Excel VBA programming on the form to draw a house method, the tutorial comparison basis, produced the effect is very good, recommend to see.
Steps
Open the Excel table and enter the VBE window.
Insert the module.
sheets */var a = Tovbarray (["Sheet1", "Sheet2", "Sheet3"]); Workbook.sheets (a). Delete ();* 3. Optionally you can create a new Sheet */var Sheet = EXCEL.SHEETS.ADD; Sheet.name = "New Sheet"; Sheet.cells (a). Value = "This is column A, row 1";//workbook.sheets ("Sheet1"). Move ("After", Workbook.sheets ("Sheet2"));/* 4. Optionally save or delete your work *///workbook.close (false); Workbook.saveas ("./t.xls");p opup ("T.xls save to:\r\n" +sheet.application.activeworkbook.path);/* 5. Keep away
use Excel VBA programming to draw a chair on a form
Steps
Open Excel and go to the Visual Basic Editor.
Insert the module.
Module programming. Programming in Module 1, declaring 4 functions, and writing a program that displays a form--"painting."
Insert the form.
Ad
" ElseIf( A andAge $) Then MsgBox "aged", vbOKOnly,"Judging Results" Else MsgBox "old age", vbOKOnly,"Judging Results" End IfEnd Sub"Select Case Statement"Select Case testexpression[Case Expressionlist-n][Statements-n] ...[Case Else[Elsestatements]]End Select"Code Area"Private SubCase Test ()DimAge as Integer Age=InputBox("Please enter your age","Enter Age window")Select Case Age Case 0 to 6 MsgBox "Childhood", vbOKOnly,"Judging Results" Case 6 to - MsgBox "Juvenile", vbOKOn
Store input data using a custom data type and display it through a popup window"Code Area"Type Lianxiren ' name as stringsex as Stringend typesub AA () Dim record as Lianxiren ' declare a lianxiren type variable record.name = Inpu Tbox ("Please enter name", "Record contact information") record. Sex = InputBox ("Please enter gender", "record Contact information") MsgBox "Name:" Record.name vblf "Gender:" Record. Sex, vbOKOnly, contact Basics End Sub"Code Interpretation"The 1th to 4th defines
= vbno ThenCancel=True End IfEnd Sub"Results show""Windowsactivate Event"The Windowsactivate event is used to save the action that responds to the activation window, and when the window is activated, the code inside the function is executed first, followed by the activation window"Code Area"Private SubWorkbook_windowsactivate (ByValWn asWindow)MsgBox "Welcome to the Excle 2013 spreadsheet handler", vbOKOnly,"Test Windowsactivate Events"End SubPrivate SubWorkbook_windowresize (ByValWn asWind
eachCityinchYunnan Debug.Print cityNextEnd Sub"execution results""two-dimensional Static array""code area"Private SubMatrix Assignment ()DimI as Integer DimJ as Integer DimA1 to 3,1 to 5) as Integer 'Use the product of I and J to fill in an array fori =1 to 3 forj =1 to 5a (i, j)= i *JNextJNextI fori =1 to 3 forj =1 to 5Debug.Print"A (" I ", " J ")=" A (i, J) Space(5); NextJ Debug.PrintNextIEnd Sub"results show""two-dimensional Dynamic array"Dim array name () as da
the name displayed on the title bar of Microsoft's main window, which returns a string type. If the title is not set for Microsoft's main window, or if its value is set to empty, this property returns a"Microsoft excle" as the default title"Code Area"Sub Change title () " oliver--excle " End Sub"Results show"The Range PropertyThe Range property returns a Range object that represents a cell or range of cellsRange Instance Address: http://www.cnblogs.com/OliverQin/p/6198441.html"Selection Pro
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.